from FlaskPro import create_app
from flask_script import Manager,Command
from flask_migrate import MigrateCommand

app = create_app()


manager = Manager(app)

class Say_hello(Command):
    def run(self):
        print("hello world")


manager.add_command("say_hello",Say_hello())
manager.add_command("db",MigrateCommand)


# @app.template_global("test_global")
# def get_page():
#     return {"name": "老边"}


# from flask  import request
# @app.before_request
# def befor_request():
#     if request.remote_addr == "127.0.0.1":
#         return "404 页面不存在"
#     print("hello world befor request is start")
#     return None
#
# @app.after_request
# def after_request():
#     if request.remote_addr == "127.0.0.1":
#         return "404 页面不存在"
#     print("hello world befor request is start")
#     return None
#
# @app.before_request
# def befor_request():
#     if request.remote_addr == "127.0.0.1":
#         return "404 页面不存在"
#     print("hello world befor request is start")
#     return None


if __name__ == '__main__':
    # db.create_all()
    # app.run(port=80)
    manager.run()